#include "widget.h"

#include <QApplication>
//按钮+复选框界面优化
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    //优化按钮样式
    //字体为30px
    QString style="QPushButton { font-size:30px; }";
    //边框宽度2px，实线、颜色红色
    style+="QPushButton { border:4px solid red; }";
    //设置圆角矩形
    style+="QPushButton { border-radius:20px }";
    //设置背景颜色
    style+="QPushButton { background-color:green; }";
    //设置文本颜色
    style+="QPushButton { color:blue; }";
    //设置鼠标点击QPushButton控件时，背景色为黑色
    style+="QPushButton:pressed { background-color:black; }";

    //复选框美化
    //设置复选框字体大小
    style+="QCheckBox { font-size:30px; } ";
    //设置复选框中选项控件的宽度和高度
    style+="QCheckBox::indicator { width:40px; height:40px; }";
    //当复选框选项控件为未选中状态时
    style+="QCheckBox::indicator:unchecked { image:url(:/1-0.png); }";
    //当复选框选选项为未选中状态且鼠标进入时
    style+="QCheckBox::indicator:unchecked:hover { image:url(:/2-0.png); }";
    //当复选框选选项为未选中状态且鼠标按下时
    style+="QCheckBox::indicator:unchecked:pressed { image:url(:/3-1.png); }";
    //当复选框选选项为选中状态时
    style+="QCheckBox::indicator:checked { image:url(:/2-1.png); }";
    //当复选框选项为选中状态且鼠标进入时
    style+="QCheckBox::indicator:checked:hover { image:url(:/1-1.png); }";
    //当复选框选选项为选中状态且鼠标按下时
    style+="QCheckBox::indicator:checked:pressed { image:url(:/3-0.png); }";

    //设置到全局样式中
    a.setStyleSheet(style);
    Widget w;
    w.show();
    return a.exec();
}
